package com.atguigu.jxc.controller;

import com.atguigu.jxc.entity.Unit;
import com.atguigu.jxc.service.UnitService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author tongatong
 * @name UnitController
 * @description
 * @date 2021/10/15
 * @time 14:51
 */
@RestController
@RequestMapping("/unit")
public class UnitController {
    @Resource
    private UnitService unitService;

    @PostMapping("/list")
    public Map<String,Object> list() {
        Map<String, Object> result = new HashMap<>();
        List<Unit> unitList = unitService.list();
        result.put("rows",unitList);
        return result;
    }
}
